using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes.DomainAttributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Enums;
using System.Collections.Generic;
using System.ComponentModel;

namespace Baci.ArcGIS._DataManagementTools._GeodatabaseAdministration
{
    /// <summary>
    /// <para>Create Role</para>
    /// <para>Creates a database role, allowing you to add users to or remove them from the role.</para>
    /// <para>创建数据库角色，允许您向该角色添加用户或从该角色中删除用户。</para>
    /// </summary>    
    [DisplayName("Create Role")]
    public class CreateRole : AbstractGPProcess
    {
        /// <summary>
        /// 无参构造
        /// </summary>
        public CreateRole()
        {

        }

        /// <summary>
        /// 有参构造
        /// </summary>
        /// <param name="_input_database">
        /// <para>Input Database Connection</para>
        /// <para>The connection file to a database or enterprise geodatabase. Connect as a database administrator user.</para>
        /// <para>数据库或企业级地理数据库的连接文件。以数据库管理员用户身份进行连接。</para>
        /// </param>
        /// <param name="_role">
        /// <para>Role</para>
        /// <para>The name of the database role to create. If it's an existing role, type the name for the role you want to add users to or remove them from.</para>
        /// <para>要创建的数据库角色的名称。如果是现有角色，请键入要向其添加用户或从中删除用户的角色的名称。</para>
        /// </param>
        public CreateRole(object _input_database, object _role)
        {
            this._input_database = _input_database;
            this._role = _role;
        }
        public override string ToolboxName => "Data Management Tools";

        public override string ToolName => "Create Role";

        public override string CallName => "management.CreateRole";

        public override List<string> AcceptEnvironments => ["workspace"];

        public override object[] ParameterInfo => [_input_database, _role, _grant_revoke.GetGPValue(), _user_name, _out_result];

        /// <summary>
        /// <para>Input Database Connection</para>
        /// <para>The connection file to a database or enterprise geodatabase. Connect as a database administrator user.</para>
        /// <para>数据库或企业级地理数据库的连接文件。以数据库管理员用户身份进行连接。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Database Connection")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _input_database { get; set; }


        /// <summary>
        /// <para>Role</para>
        /// <para>The name of the database role to create. If it's an existing role, type the name for the role you want to add users to or remove them from.</para>
        /// <para>要创建的数据库角色的名称。如果是现有角色，请键入要向其添加用户或从中删除用户的角色的名称。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Role")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _role { get; set; }


        /// <summary>
        /// <para>Grant To or Revoke From User(s)</para>
        /// <para><xdoc>
        ///   <para>Specifies whether the role will be added to a user or list of users or a user or list of users will be removed from the role.</para>
        ///   <bulletList>
        ///     <bullet_item>Grant role—The role will be granted to the specified user or users, making them a member of the role. This is the default.</bullet_item><para/>
        ///     <bullet_item>Revoke role—The role will be revoked from the specified user or users, removing them from the role.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定是将角色添加到用户或用户列表，还是从角色中删除用户或用户列表。</para>
        ///   <bulletList>
        ///     <bullet_item>授予角色 - 该角色将授予指定的一个或多个用户，使他们成为角色的成员。这是默认设置。</bullet_item><para/>
        ///     <bullet_item>撤销角色 - 将从指定用户或用户中撤消该角色，从而将其从角色中移除。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Grant To or Revoke From User(s)")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _grant_revoke_value _grant_revoke { get; set; } = _grant_revoke_value._GRANT;

        public enum _grant_revoke_value
        {
            /// <summary>
            /// <para>Grant role</para>
            /// <para>Grant role—The role will be granted to the specified user or users, making them a member of the role. This is the default.</para>
            /// <para>授予角色 - 该角色将授予指定的一个或多个用户，使他们成为角色的成员。这是默认设置。</para>
            /// </summary>
            [Description("Grant role")]
            [GPEnumValue("GRANT")]
            _GRANT,

            /// <summary>
            /// <para>Revoke role</para>
            /// <para>Revoke role—The role will be revoked from the specified user or users, removing them from the role.</para>
            /// <para>撤销角色 - 将从指定用户或用户中撤消该角色，从而将其从角色中移除。</para>
            /// </summary>
            [Description("Revoke role")]
            [GPEnumValue("REVOKE")]
            _REVOKE,

        }

        /// <summary>
        /// <para>User Name(s)</para>
        /// <para>The name of the user whose role membership will change. To specify multiple users, type the user names separated by commas (no spaces).</para>
        /// <para>其角色成员身份将更改的用户的名称。若要指定多个用户，请键入以逗号分隔的用户名（无空格）。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("User Name(s)")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _user_name { get; set; } = null;


        /// <summary>
        /// <para>Create Role Succeeded</para>
        /// <para></para>
        /// <para></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Create Role Succeeded")]
        [Description("")]
        [Option(OptionTypeEnum.derived)]
        public object _out_result { get; set; }


        public CreateRole SetEnv(object workspace = null)
        {
            base.SetEnv(workspace: workspace);
            return this;
        }

    }

}